/**
 * Project Name:nplus1
 * File Name:AttacheUploadController.java
 * Package Name:com.gamma.nplus1.common.web
 * Date:2017年5月27日上午7:46:01
 * Copyright (c) 2017, nplus1 Co., Ltd. All Rights Reserved.
 *
*/

package com.gamma.nplus1.common.web;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.fileupload.FileUploadException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * ClassName:AttacheUploadController <br/>
 * Function: 附件上传控制器. <br/>
 * Date:     2017年5月27日 上午7:46:01 <br/>
 * @author   jeno
 * @version  
 * @since    JDK 1.7
 */
@Controller
@RequestMapping(value = "${adminPath}/attache")
public class AttacheUploadController extends BaseController {

	/**
	 * 文件上传
	 * 
	 * @param request
	 * @param response
	 * @return
	 * @throws ServletException
	 * @throws IOException
	 * @throws FileUploadException
	 */
	@SuppressWarnings("rawtypes")
	@RequestMapping(method = RequestMethod.POST, value = "upload")
	@ResponseBody
	public void upload(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException, FileUploadException {
		Map<String, Object> msg = new HashMap<String, Object>();
		msg.put("error", 0);
		msg.put("url", "/nplus1/static/images/1.png");
		
		renderString(response, msg);
	}
}

